package com.zmj.demo.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zmj.framework.base.service.impl.BaseServiceImpl;
import com.zmj.framework.common.CommonConstant;
import org.springframework.stereotype.Service;
import com.zmj.demo.pojo.entity.PageEntity;
import com.zmj.demo.mapper.IPageMapper;
import com.zmj.demo.service.PageService;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zmj.org
 * @since 2024-04-08
 */
@Service
public class PageServiceImpl extends BaseServiceImpl<IPageMapper, PageEntity> implements PageService {
    @Override
    public IPage<PageEntity> pageList(IPage<PageEntity> page, Map<String, Object> param) {
        return this.page(page, Wrappers.<PageEntity>lambdaQuery()
                .eq(PageEntity::getIsDelete, CommonConstant.NO)
                .eq(ObjectUtil.isNotNull(param.get("id")), PageEntity::getId, param.get("id"))
                .eq(ObjectUtil.isNotEmpty(param.get("name")), PageEntity::getName, param.get("name")));
    }
}
